const axios = require("axios")
var exp = {
    login: login,
    getmoney:getmoney,
    open: open,
}
async function login() {
    var res = await axios({
        method: "post",
        url: "https://dcxy-customer-app.dcrym.com/app/customer/login",
        headers: {
            "clientSource": '{"areaId":"","customerId":"","uuid":"357694476620991","sourceType":"Android","appVersion":"4.3.7","platformCode":"00001","systemVersion":"23","deviceInfo":"Xiaomi RedmiNote4","networkInfo":" WIFI"}',
            "ContentType": "application/json"
        },
        data: {
//登录的账号和密码
            "loginAccount": "",
            "password": ""
          }
    });
    return res.data.data.token;
}
async function getmoney(token) {
    var res = await axios({
        method: "get",
        url: "https://dcxy-customer-app.dcrym.com/account/current/all",
        headers: {
            "token": token,
            "ContentType": "application/json"}
})
    return res.data.data.accountNewVos[0];
};
async function open(floor,token){
    let res =  await axios({
        method: "post",
        url: `https://gx-app-server.dcrym.com/dcxy/api/gx/devices/${floor}/beginning`,
        headers: {
            "token": token,
            "reqSource": "app",
        },
        data: {"customerId":"2926094","customerName":"叶平","customerPhone":"18712337064","campusId":"267"}
    });
    return res.data;
}
module.exports = exp;